package com.example.shop.user.dao;

import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.example.shop.goods.dto.GoodsTypeFondRatio;
import com.example.shop.user.dto.BrowsingDateTimeRangeParam;
import com.example.shop.user.dto.BrowsingHistory;
import com.example.shop.user.dto.BrowsingHistoryQueryParam;
import org.apache.ibatis.annotations.*;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface UserBrowsingHistoryDao {

    @ResultMap("com.example.shop.goods.dao.GoodsBrowseInfoDao.GoodsBrowseInfoResultMap")
    @Select("<script>" +
            "select g.merchant_id,g.goods_id, goods_type, g.goods_name, " +
            "g.purchased_time,gc.goods_class, gc.class_price, gc.class_inventory, " +
            "ubh.browse_date " +
            "from " +
            "goods g " +
            "join r_goods_class gc on g.goods_id = gc.goods_id " +
            "join r_user_browse_history ubh on g.goods_id = ubh.goods_id " +
            "where ubh.user_id = ${userId} and " +
            BrowsingHistoryQueryParam.QUERY_PARAM_SQL +
            "</script>")
    List<BrowsingHistory> selectByUserId(@Param("userId") long userId, @Param(Constants.WRAPPER) BrowsingHistoryQueryParam queryParam);



}
